import { sm4 } from 'sm-crypto'

const iv = "fedcba98765432100123456789abcdef";
const key = "shdju54d8f45g4t7f458d4r7f4d1c473";

// 加密
export const encryptData = (textToEncrypt: string) => {
  const encryptData = sm4.encrypt(textToEncrypt, key, { mode: 'cbc', iv })
  return encryptData;
}

// 解密
export function decrypt(encryptedText: string) {
  const decryptData = sm4.decrypt(encryptedText, key, { mode: 'cbc', iv }) // 解密，cbc 模式
  return decryptData
}